home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume14 / unzip-3.1 / part01 < prev    next >
Encoding:
Text File  |  1990-09-20  |  58.6 KB  |  1,817 lines

  1. Newsgroups: comp.sources.misc
  2. From: kirsch@usasoc.soc.mil (David Kirschbaum)
  3. Subject: v14i104: Portable UnZIP 3.1 (part 1 of 3)
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 14, Issue 104
  7. Submitted-by: kirsch@usasoc.soc.mil (David Kirschbaum)
  8. Archive-name: unzip-3.1/part01
  9.  
  10. #This is part 1 of 3 shar files that will produce full source,
  11. #makefiles, brief documentation, etc. for a generic Unix unzip utility.
  12.  
  13. #This unzip, produced by the Info-ZIP EMail workgroup, is fully compatible
  14. #with Phil Katz' MS-DOS PKZIP.EXE file compression and archiving utility.
  15. #A flexible Makefile provides compilation for a WIDE range of Unix systems.
  16.  
  17. #To contact Info-ZIP for reporting bugs/improvements/additional ports:
  18. #  Usenet people via uucp:  uunet!wsmr-simtel20.army.mil!info-zip
  19. #  ARPAnet:           Info-ZIP@wsmr-simtel20.army.mil
  20.  
  21. #David Kirschbaum
  22. #Toad Hall
  23. #Info-ZIP Coordinator
  24. #kirsch@usasoc.soc.mil
  25. #
  26. #! /bin/sh
  27. # This is a shell archive.  Remove anything before this line, then unpack
  28. # it by saving it into a file and typing "sh file".  To overwrite existing
  29. # files, type "sh file -c".  You can also feed this as standard input via
  30. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  31. # will see the following message at the end:
  32. #        "End of archive 1 (of 3)."
  33. # Contents:  Makefile.min Makefile.mip ascebc.c coherent.pat crc32.c
  34. #   info-zip.msg levels.uue mapname.c match.c minix20g.pat mips.pat
  35. #   unreduce.c unshrink.c unzip.man unzip310.des zmemcpy.c zmemset.c
  36. # Wrapped by kirsch@usasoc.soc.mil on Fri Aug 31 11:37:49 1990
  37. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  38. if test -f 'Makefile.min' -a "${1}" != "-c" ; then 
  39.   echo shar: Will not clobber existing file \"'Makefile.min'\"
  40. else
  41. echo shar: Extracting \"'Makefile.min'\" \(220 characters\)
  42. sed "s/^X//" >'Makefile.min' <<'END_OF_FILE'
  43. X# Makefile for unzip30 under Minix
  44. X#Regards,
  45. X#Mark
  46. X#mbeck@ai.mit.edu
  47. X
  48. XCFLAGS = -c -DUNIX -DZMEM
  49. X
  50. XOBJS=    unzip.s match.s crc32.s ascebc.s zmemcpy.s zmemset.s
  51. X
  52. X.c.s:
  53. X    cc $(CFLAGS) $<
  54. X
  55. Xunzip:    $(OBJS)
  56. X    cc -i -o unzip $(OBJS)
  57. END_OF_FILE
  58. if test 220 -ne `wc -c <'Makefile.min'`; then
  59.     echo shar: \"'Makefile.min'\" unpacked with wrong size!
  60. fi
  61. # end of 'Makefile.min'
  62. fi
  63. if test -f 'Makefile.mip' -a "${1}" != "-c" ; then 
  64.   echo shar: Will not clobber existing file \"'Makefile.mip'\"
  65. else
  66. echo shar: Extracting \"'Makefile.mip'\" \(5757 characters\)
  67. sed "s/^X//" >'Makefile.mip' <<'END_OF_FILE'
  68. X# Makefile for unzip20i
  69. X# P. Jones UQAM April 27th, 1990
  70. X# Added support for Mips
  71. X# "make vaxbsd" -- makes unzip on a VAX 11-780 BSD 4.3 in current directory
  72. X# "make"    -- uses environment variable SYSTEM to set the type
  73. X#           system to compile for.
  74. X# "make wombat" -- Chokes and dies if you haven't added the specifics
  75. X#           for your Wombat 68000 (or whatever) to the systems list.
  76. X#
  77. X# CFLAGS are flags for the C compiler.  LDFLAGS are flags for the loader.
  78. X#
  79. X# My host (a VAX 11-780 running BSD 4.3) is hereafter referred to as
  80. X# "my host."
  81. X#
  82. X# My host's /usr/include/sys/param.h defines BSD for me.
  83. X# You may have to add "-DBSD" to the list of CFLAGS for your system.
  84. X#
  85. X# You MAY need to define "-DNOTINT16" if the program produces crc errors
  86. X# during a "-t" run or extraction.  (This involves structure alignment.)
  87. X# It won't HURT to define "-dNOTINT16" anyway .. but if you don't need it,
  88. X# why add to the program size, complexity, etc.?
  89. X#
  90. X# If your host is "big-endian" (as in the 68000 family) and does NOT order
  91. X# its integers and long integers in Intel fashion (low .. high), you should
  92. X# define "-DHIGH_LOW".  This insures key structure values will be "swapped"
  93. X# low end for high end.
  94. X# Some mainframes DO require this.
  95. X#
  96. X# Some systems have a shell-defined "$MAKE" (my host did not).  If not,
  97. X# use "make" instead of the "$MAKE" or "$(MAKE)" in your system's makerule.
  98. X# Or try adding the following line to your .login file:
  99. X#   setenv MAKE "make"
  100. X# (It didn't help on my host.)
  101. X#
  102. X# zmemcpy has been added to the list of required files for some systems.
  103. X# memcpy() is a normal C function that works just fine in Turbo C
  104. X# and some Unix systems, but has a problem in others (producing CRC errors).
  105. X#
  106. X# You can try a compile without zmemcpy.c, and if it works .. fine.
  107. X# (To do this, you may have to remove zmemcpy.o from your system's list
  108. X# of required OBJS files, and the "-DZMEM" from the list of CFLAGS defines.)
  109. X#
  110. X# Else use the included zmemcpy.c.
  111. X# (Again, you may have to add zmemcpy.o to your system's list of required
  112. X# OBJS files, and the "-DZMEM" to the list of CFLAGS defines.)
  113. X
  114. X# To test, insure your zip file includes some LARGE members.  Many systems
  115. X# ran just fine with zip file members <512 bytes, but failed with larger ones.
  116. X#
  117. X
  118. X# Defaults most systems use
  119. XCFLAGS = -O -DUNIX
  120. X
  121. XCC=cc
  122. X
  123. X.c.o :
  124. X    $(CC) -c $(CFLAGS) $*.c
  125. X
  126. X# Defaults everybody uses
  127. XOBJS = unzip.o crc32.o match.o ascebc.o mapname.o
  128. XSRCS = unzip.c crc32.c match.c ascebc.c mapname.c
  129. X
  130. X# You'll need these also if you include "-DZMEM" in your CFLAGS
  131. XZMEMC = zmemset.c zmemcpy.c
  132. XZMEMS = zmemset.o zmemcpy.o
  133. X
  134. X# list of supported systems in this version
  135. XSYSTEMS    =xenix386 ultrix sun3 sun4 encore stellar convex vaxbsd next vaxsysV mips
  136. XSYSTEM = MIPS
  137. X
  138. X# The code below will try to use your shell variable "SYSTEM"
  139. X# as the type system to use (e.g., if you command:
  140. X# make <no parameters>
  141. X# at the command line).
  142. X
  143. Xdefault:
  144. X       - test  -z $(SYSTEM) -f Makefile.mips  \
  145. X       && make ERROR -f Makefile.mips \
  146. X       || make $(SYSTEM) -f Makefile.mips
  147. X       exit
  148. X
  149. XERROR:
  150. X    @echo "Must make one of $(SYSTEMS)"
  151. X    @echo "or set shell variable SYSTEM to a legal value"
  152. X    exit 1
  153. X
  154. Xunzip: $(OBJS)
  155. X    cc $(LDFLAGS) -o unzip $(OBJS)
  156. X      rm $(OBJS)
  157. X
  158. Xunzip.o: unzip.c
  159. X
  160. Xcrc32.o: crc32.c
  161. X
  162. Xmatch.o: match.c
  163. X
  164. Xascebc.o: ascebc.c
  165. X
  166. Xzmemcpy.o: zmemcpy.c
  167. X
  168. Xzmemset.o: zmemset.c
  169. X
  170. Xmapname.o: mapname.c
  171. X#
  172. X# these are the makerules for various systems
  173. X# TABS ARE REQUIRED FOR SOME VERSIONS OF make!
  174. X# DO NOT DE-TABIFY THIS FILE!
  175. X# Example:
  176. X# wombat:^I# wombat 68000
  177. X#        ^this is an ASCII 9 tab char, NOT a bunch of spaces!
  178. X#^I$(MAKE) unzip CFLAGS="$(CFLAGS) -DNOTINT16 -DZMEM" \
  179. X#^IOBJS="$(OBJS) $(ZMEMS)"
  180. X#^these indentations are an ASCII 9 tab char!
  181. X
  182. Xxenix386:    # Xenix/386 (tested on 2.3.1)
  183. X    $(MAKE) unzip CFLAGS="$(CFLAGS) -DZMEM" \
  184. X    OBJS="$(OBJS) $(ZMEMS)"
  185. X
  186. XvaxsysV:    # from Forrest Gehrke
  187. Xencore:        # Multimax
  188. X    $(MAKE) unzip CFLAGS="$(CFLAGS) -DZMEM" \
  189. X    OBJS="$(OBJS) $(ZMEMS)"
  190. X
  191. Xstellar:    # gs-2000
  192. X    $(MAKE) unzip CFLAGS="$(CFLAGS) -DNOTINT16 -DZMEM" \
  193. X    OBJS="$(OBJS) $(ZMEMS)"
  194. X
  195. Xsun3:        # 68020, SunOS 4.0.3
  196. X    $(MAKE) unzip CFLAGS="$(CFLAGS) -DHIGH_LOW -DZMEM" \
  197. X    OBJS="$(OBJS) $(ZMEMS)"
  198. X
  199. Xsun4:        # Sun 4/110, SunOS 4.0.3c
  200. X        # v2.0g Removed -DHIGH_LOW (my mistake) David Kirschbaum
  201. X    $(MAKE) unzip CFLAGS="$(CFLAGS) -DNOTINT16 -DZMEM" \
  202. X    OBJS="$(OBJS) $(ZMEMS)"
  203. X
  204. Xconvex:        # C200/C400
  205. X    $(MAKE) unzip CFLAGS="$(CFLAGS) -DNOTINT16 -DZMEM" \
  206. X    OBJS="$(OBJS) $(ZMEMS)"
  207. X
  208. X# My Vax doesn't know anything about "$(MAKE)".
  209. X# I tried adding 'setenv MAKE "make" to my .login
  210. X# but it still wouldn't.  Unix wizards, to the rescue!
  211. X
  212. Xultrix:        # per Greg Flint
  213. Xvaxbsd:        # VAX 11-780, BSD 4.3    David Kirschbaum
  214. X#    $(MAKE) unzip
  215. X    make unzip
  216. X
  217. X#From Mark Adler, madler@tybalt.caltech.edu:
  218. X#  I used "make stellar" on the NeXT and the resulting unzip
  219. X#  worked fine on all my zip test files.  Not willing to leave
  220. X#  well enough alone, I tried it without the zmem* routines by
  221. X#  adding the following to the Makefile:
  222. X
  223. Xnext:        # 68030 BSD 4.3+Mach
  224. X    $(MAKE) unzip CFLAGS="$(CFLAGS) -DNOTINT16" \
  225. X    OBJS="$(OBJS)"
  226. X
  227. X#  and using "make next".  This also worked fine, and presumably
  228. X#  is faster since the native memcpy and memset routines are
  229. X#  optimized assembler.
  230. X
  231. X# Mips code is here
  232. Xmips: #MIPS System V
  233. X#Print system identification
  234. X      uname -A
  235. X# Show file creation date
  236. X      ls -l Makefile.mips Makefile
  237. X#show differences in Makefile and this file
  238. X      @- diff Makefile Makefile.mips
  239. X#Actual coplilation run
  240. X      $(MAKE) unzip CFLAGS="$(CFLAGS) -DNOTINT16 -DZMEM"      \
  241. X      OBJS="$(OBJS) $(ZMEMS)"  
  242. X#Test on a handy file
  243. X      ./unzip -t levels.zip
  244. X#Run lint to finish up
  245. X      lint $(CFLAGS) -DNOTINT16 -DZMEM $(SRCS) $(ZMEMC)
  246. X
  247. X# added the useful function below....
  248. Xclean:
  249. X      - rm $(OBJS) 
  250. X      - rm unzip
  251. END_OF_FILE
  252. if test 5757 -ne `wc -c <'Makefile.mip'`; then
  253.     echo shar: \"'Makefile.mip'\" unpacked with wrong size!
  254. fi
  255. # end of 'Makefile.mip'
  256. fi
  257. if test -f 'ascebc.c' -a "${1}" != "-c" ; then 
  258.   echo shar: Will not clobber existing file \"'ascebc.c'\"
  259. else
  260. echo shar: Extracting \"'ascebc.c'\" \(3430 characters\)
  261. sed "s/^X//" >'ascebc.c' <<'END_OF_FILE'
  262. X/* ascebc.c -  ASCii to EBCdic.                             
  263. X *             Written by Allan Bjorklund
  264. X *             March 21, 1990
  265. X *
  266. X * v3.04 No more need for ae_buf() since no longer used.
  267. X * v3.01 patched by Bo Kullmar to fix an -a switch bug.
  268. X * patch is in kullmar.pat
  269. X */
  270. X
  271. X#ifdef EBCDIC                                 /* Thy may want only the <CR><NL> to <SP><NL> routine */
  272. X/*  This is the translation table MTS uses.  (7bit ascii to ebcdic) */
  273. Xstatic unsigned char ebcdic [] = {0x00,0x01,0x02,0x03,0x37,0x2d,0x2e,0x2f,0x16,0x05,0x25,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x3c,0x3d,0x32,0x26,0x18,0x19,0x3f,0x27,0x1c,0x1d,0x1e,0x1f,
  274. X0x40,0x5a,0x7f,0x7b,0x5b,0x6c,0x50,0x7d,0x4d,0x5d,0x5c,0x4e,0x6b,0x60,0x4b,0x61,0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0x7a,0x5e,0x4c,0x7e,0x6e,0x6f,
  275. X0x7c,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xba,0xe0,0xbb,0xb0,0x6d,
  276. X0x79,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xc0,0x4f,0xd0,0xa1,0x07,
  277. X0x20,0x21,0x22,0x23,0x24,0x15,0x06,0x17,0x28,0x29,0x2a,0x2b,0x2c,0x09,0x0a,0x1b,0x30,0x31,0x1a,0x33,0x34,0x35,0x36,0x08,0x38,0x39,0x3a,0x3b,0x04,0x14,0x3e,0xff,
  278. X0x41,0xaa,0x4a,0xb1,0x9f,0xb2,0x6a,0xb5,0xbd,0xb4,0x9a,0x8a,0x5f,0xca,0xaf,0xbc,0x90,0x8f,0xea,0xfa,0xbe,0xa0,0xb6,0xb3,0x9d,0xda,0x9b,0x8b,0xb7,0xb8,0xb9,0xab,
  279. X0x64,0x65,0x62,0x66,0x63,0x67,0x9e,0x68,0x74,0x71,0x72,0x73,0x78,0x75,0x76,0x77,0xac,0x69,0xed,0xee,0xeb,0xef,0xec,0xbf,0x80,0xfd,0xfe,0xfb,0xfc,0xad,0xae,0x59,
  280. X0x44,0x45,0x42,0x46,0x43,0x47,0x9c,0x48,0x54,0x51,0x52,0x53,0x58,0x55,0x56,0x57,0x8c,0x49,0xcd,0xce,0xcb,0xcf,0xcc,0xe1,0x70,0xdd,0xde,0xdb,0xdc,0x8d,0x8e,0xdf}; 
  281. X                      
  282. X  
  283. X#include <string.h>
  284. X/* a_to_e - This is the routine that does the translation.
  285. X *
  286. X * instr (in/out) - the string to be translated.
  287. X *
  288. X */
  289. Xvoid a_to_e ( instr )
  290. X     char *instr;
  291. X     {
  292. X      int index;      /* Just to keep track of where we are in the string */
  293. X      int counter;    /* The length of the string */
  294. X      
  295. X      counter = strlen(instr);     /* The string must be null terminated */
  296. X      for (index = 0; index <= counter; index++)
  297. X          {
  298. X           instr[index] = ebcdic[instr[index]];
  299. X          }
  300. X      return;
  301. X     }
  302. X#endif
  303. X#ifdef BEFORE304 
  304. X/* ae_buf - This routine translates a buffer instead of a string
  305. X *          and substitues <SP><NL> for <CR><NL>.  Returns an integer
  306. X *          indicating the number of bytes after conversion.
  307. X *
  308. X *          Put in the #ifdef so that the routine could
  309. X *          be used to convert the <CR><NL> to <SP><NL>
  310. X *          on non ebcdic systems.   A.B. 03/21/90
  311. X *
  312. X * cbuff (in/out) - The buffer to be translated.
  313. X * numb  (in)     - The number of Bytes comming in.
  314. X */
  315. X#ifdef EBCDIC
  316. X#define SPACE 0x40
  317. X#else
  318. X#define SPACE 0x20
  319. X#endif
  320. X   
  321. Xvoid ae_buf ( cbuff, numb )
  322. X     char *cbuff;
  323. X     int *numb;
  324. X     {
  325. X      int index;     /* Where are we in the array */
  326. X      int ocount = 0;
  327. X  
  328. X      for (index = 0; index <= *numb; index++) 
  329. X          {
  330. X       if (cbuff[index] != 0x0d)
  331. X          {
  332. X#ifdef EBCDIC                                  /* See above */
  333. X               cbuff[ocount++] = ebcdic[cbuff[index]];
  334. X#else
  335. X               cbuff[ocount++] = cbuff[index];
  336. X#endif
  337. X          }
  338. X          }
  339. X      *numb = ocount;
  340. X     }
  341. X#endif    /* BEFORE304 */
  342. END_OF_FILE
  343. if test 3430 -ne `wc -c <'ascebc.c'`; then
  344.     echo shar: \"'ascebc.c'\" unpacked with wrong size!
  345. fi
  346. # end of 'ascebc.c'
  347. fi
  348. if test -f 'coherent.pat' -a "${1}" != "-c" ; then 
  349.   echo shar: Will not clobber existing file \"'coherent.pat'\"
  350. else
  351. echo shar: Extracting \"'coherent.pat'\" \(4751 characters\)
  352. sed "s/^X//" >'coherent.pat' <<'END_OF_FILE'
  353. X[These patches have been installed in version 3.10.
  354. X They actually had to be manually installed in unzip.h since the dif files
  355. X were intended for an earlier unzip.c where all the defines, etc. were
  356. X still in the one file.
  357. X For them to take effect, you must (of course) define COHERENT somewhere
  358. X (like in your Makefile).  Our Makefile has NOT been enabled for Coherent.
  359. X
  360. X David Kirschbaum
  361. X Toad Hall
  362. X]
  363. X
  364. XFrom @WSMR-SIMTEL20.ARMY.MIL:kirsch@usasoc.soc.mil Wed Aug  8 19:23:51 1990
  365. XReceived: from usasoc.soc.mil by WSMR-SIMTEL20.ARMY.MIL with TCP; Wed, 8 Aug 90 15:37:55 MDT
  366. XDate: Wed, 8 Aug 90 17:37:25 -0400
  367. XFrom: David Kirschbaum <kirsch>
  368. XMessage-Id: <9008082137.AA03919@usasoc.soc.mil>
  369. XTo: INFO-ZIP <info-zip@WSMR-Simtel20.Army.Mil>
  370. XCc: Esa T. Aloha <msdc!esa@uunet.UU.NET>, kirsch <kirsch@usasoc.soc.mil>
  371. XSubject:  Re:  Unzip30 & Coherent
  372. XStatus: R
  373. X
  374. XOf COURSE you can distribute it!  We're talking public domain here, folks;
  375. Xthe good old-fashioned, "do anything you want with this sucker" kind...
  376. X
  377. XI'm really kinda amazed at the relatively few diffs that came up in
  378. Xporting it to Coherent .. really all quite forseeable stuff! Heck, we had
  379. Xmore trouble with flavors of true-blue Unix!
  380. X
  381. XFor the rest of the Info-ZIP people: I'll be posting the differences
  382. X(eventually), to be distributed as v3.08 (whenever ...  I'm waiting for
  383. Xsome Atari/TurboC patches from Germany).  I may throw in some v3.08
  384. Xnumbers in the diff patches just to help in tracking changes.
  385. X
  386. XIncidentally, how many snarfers of the unzip307.tar-Z file from SIMTEL20
  387. Xnoticed that bug.lst somehow became a tar of all the OTHER files! Yep,
  388. X180K or so!  Donno HOW that happened!  Anyway, just uploaded a fixed
  389. Xversion, so SIMTEL archives are up to date per v3.07 anyway.
  390. X
  391. XDavid Kirschbaum
  392. XInfo-ZIP Coordinator
  393. X
  394. X----- Forwarded Message Start
  395. X
  396. XReceived: from msdc.UUCP by uunet.uu.net (5.61/1.14) with UUCP
  397. X        id AA20573; Wed, 8 Aug 90 15:47:41 -0400
  398. XMessage-Id: <9008081939.AA10689@msdc.msdc.com>
  399. XFrom: msdc!esa@uunet.UU.NET (Esa T. Ahola)
  400. XDate: Wed, 8 Aug 90 15:31:45 EDT
  401. XX-Mailer: Mail User's Shell (7.0.4 1/31/90)
  402. XTo: kirsch@usasoc.soc.mil
  403. XSubject: Unzip30 & Coherent
  404. X
  405. XI have ported Unzip 3.0 to Coherent (a V7-clone by Mark Williams Co) and
  406. Xwould like permission to distribute it to other Coherent users (we have
  407. Xan active mailing list).  Diffs below:
  408. X
  409. XOnly in unzip: Makefile.mwc
  410. Xdiff -c unzip.orig/unzip.c unzip/unzip.c
  411. X*** unzip.orig/unzip.c  Thu May  3 17:02:50 1990
  412. X--- unzip/unzip.c       Wed Aug  8 15:05:14 1990
  413. X***************
  414. X*** 54,59
  415. X
  416. X  #ifdef __STDC__
  417. X
  418. X  #include <stdlib.h>
  419. X   /* this include defines various standard library prototypes */
  420. X
  421. X
  422. X--- 54,60 -----
  423. X
  424. X  #ifdef __STDC__
  425. X
  426. X+ #ifndef COHERENT
  427. X  #include <stdlib.h>
  428. X  #endif
  429. X   /* this include defines various standard library prototypes */
  430. X***************
  431. X*** 55,60
  432. X  #ifdef __STDC__
  433. X
  434. X  #include <stdlib.h>
  435. X   /* this include defines various standard library prototypes */
  436. X
  437. X  #else
  438. X
  439. X--- 56,62 -----
  440. X
  441. X  #ifndef COHERENT
  442. X  #include <stdlib.h>
  443. X+ #endif
  444. X   /* this include defines various standard library prototypes */
  445. X
  446. X  #else
  447. X***************
  448. X*** 351,356
  449. X  #include <sys/param.h>
  450. X  #define ZSUFX ".zip"
  451. X  #ifndef BSIZE
  452. X  #define BSIZE DEV_BSIZE     /* v2.0c assume common for all Unix systems */
  453. X  #endif
  454. X  #ifndef BSD                 /* v2.0b */
  455. X
  456. X--- 353,361 -----
  457. X  #include <sys/param.h>
  458. X  #define ZSUFX ".zip"
  459. X  #ifndef BSIZE
  460. X+ #ifdef COHERENT
  461. X+ #define BSIZE 512
  462. X+ #else
  463. X  #define BSIZE DEV_BSIZE     /* v2.0c assume common for all Unix systems */
  464. X  #endif
  465. X  #endif
  466. X***************
  467. X*** 353,358
  468. X  #ifndef BSIZE
  469. X  #define BSIZE DEV_BSIZE     /* v2.0c assume common for all Unix systems */
  470. X  #endif
  471. X  #ifndef BSD                 /* v2.0b */
  472. X  #include <time.h>
  473. X  struct tm *gmtime(), *localtime();
  474. X
  475. X--- 358,364 -----
  476. X  #else
  477. X  #define BSIZE DEV_BSIZE     /* v2.0c assume common for all Unix systems */
  478. X  #endif
  479. X+ #endif
  480. X  #ifndef BSD                 /* v2.0b */
  481. X  #include <time.h>
  482. X  struct tm *gmtime(), *localtime();
  483. X***************
  484. X*** 399,404
  485. X
  486. X  #else   /* !V7 */
  487. X
  488. X  #include <fcntl.h>
  489. X   /*
  490. X    * this include file defines
  491. X
  492. X--- 405,413 -----
  493. X
  494. X  #else   /* !V7 */
  495. X
  496. X+ #ifdef COHERENT
  497. X+ #include <sys/fcntl.h>
  498. X+ #else
  499. X  #include <fcntl.h>
  500. X  #endif
  501. X   /*
  502. X***************
  503. X*** 400,405
  504. X  #else   /* !V7 */
  505. X
  506. X  #include <fcntl.h>
  507. X   /*
  508. X    * this include file defines
  509. X    *             #define O_BINARY 0x8000  (* no cr-lf translation *)
  510. X
  511. X--- 409,415 -----
  512. X  #include <sys/fcntl.h>
  513. X  #else
  514. X  #include <fcntl.h>
  515. X+ #endif
  516. X   /*
  517. X    * this include file defines
  518. X    *             #define O_BINARY 0x8000  (* no cr-lf translation *)
  519. X
  520. X--
  521. XEsa Ahola           esa@msdc.com      uunet!msdc!esa        CIS:70012,2753
  522. XMedical Systems Development Corporation (MsdC), Atlanta GA  (404) 589-3368
  523. X
  524. X
  525. X----- End of Forwarded Message
  526. X
  527. END_OF_FILE
  528. if test 4751 -ne `wc -c <'coherent.pat'`; then
  529.     echo shar: \"'coherent.pat'\" unpacked with wrong size!
  530. fi
  531. # end of 'coherent.pat'
  532. fi
  533. if test -f 'crc32.c' -a "${1}" != "-c" ; then 
  534.   echo shar: Will not clobber existing file \"'crc32.c'\"
  535. else
  536. echo shar: Extracting \"'crc32.c'\" \(7543 characters\)
  537. sed "s/^X//" >'crc32.c' <<'END_OF_FILE'
  538. X/*
  539. X * crc32.c
  540. X *
  541. X * REVISION HISTORY
  542. X *
  543. X * 11/16/89  C. Mascott     keep working crcval in register
  544. X *
  545. X */
  546. X
  547. X  /* ============================================================= */
  548. X  /*  COPYRIGHT (C) 1986 Gary S. Brown.  You may use this program, or       */
  549. X  /*  code or tables extracted from it, as desired without restriction.     */
  550. X  /*                                                                        */
  551. X  /*  First, the polynomial itself and its table of feedback terms.  The    */
  552. X  /*  polynomial is                                                         */
  553. X  /*  X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0   */
  554. X  /*                                                                        */
  555. X  /*  Note that we take it "backwards" and put the highest-order term in    */
  556. X  /*  the lowest-order bit.  The X^32 term is "implied"; the LSB is the     */
  557. X  /*  X^31 term, etc.  The X^0 term (usually shown as "+1") results in      */
  558. X  /*  the MSB being 1.                                                      */
  559. X  /*                                                                        */
  560. X  /*  Note that the usual hardware shift register implementation, which     */
  561. X  /*  is what we're using (we're merely optimizing it by doing eight-bit    */
  562. X  /*  chunks at a time) shifts bits into the lowest-order term.  In our     */
  563. X  /*  implementation, that means shifting towards the right.  Why do we     */
  564. X  /*  do it this way?  Because the calculated CRC must be transmitted in    */
  565. X  /*  order from highest-order term to lowest-order term.  UARTs transmit   */
  566. X  /*  characters in order from LSB to MSB.  By storing the CRC this way,    */
  567. X  /*  we hand it to the UART in the order low-byte to high-byte; the UART   */
  568. X  /*  sends each low-bit to hight-bit; and the result is transmission bit   */
  569. X  /*  by bit from highest- to lowest-order term without requiring any bit   */
  570. X  /*  shuffling on our part.  Reception works similarly.                    */
  571. X  /*                                                                        */
  572. X  /*  The feedback terms table consists of 256, 32-bit entries.  Notes:     */
  573. X  /*                                                                        */
  574. X  /*      The table can be generated at runtime if desired; code to do so   */
  575. X  /*      is shown later.  It might not be obvious, but the feedback        */
  576. X  /*      terms simply represent the results of eight shift/xor opera-      */
  577. X  /*      tions for all combinations of data and CRC register values.       */
  578. X  /*                                                                        */
  579. X  /*      The values must be right-shifted by eight bits by the "updcrc"    */
  580. X  /*      logic; the shift must be unsigned (bring in zeroes).  On some     */
  581. X  /*      hardware you could probably optimize the shift in assembler by    */
  582. X  /*      using byte-swap instructions.                                     */
  583. X  /*      polynomial $edb88320                                              */
  584. X  /*                                                                        */
  585. X  /*  --------------------------------------------------------------------  */
  586. X
  587. Xunsigned long crc_32_tab[] = {      /* v2.0d */
  588. X      0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
  589. X      0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
  590. X      0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
  591. X      0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
  592. X      0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
  593. X      0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
  594. X      0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
  595. X      0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
  596. X      0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
  597. X      0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
  598. X      0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
  599. X      0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
  600. X      0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
  601. X      0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
  602. X      0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
  603. X      0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
  604. X      0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
  605. X      0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
  606. X      0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
  607. X      0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
  608. X      0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
  609. X      0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
  610. X      0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
  611. X      0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
  612. X      0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
  613. X      0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
  614. X      0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
  615. X      0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
  616. X      0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
  617. X      0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
  618. X      0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
  619. X      0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
  620. X      0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
  621. X      0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
  622. X      0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
  623. X      0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
  624. X      0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
  625. X      0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
  626. X      0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
  627. X      0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
  628. X      0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
  629. X      0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
  630. X      0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
  631. X      0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
  632. X      0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
  633. X      0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
  634. X      0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
  635. X      0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
  636. X      0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
  637. X      0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
  638. X      0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
  639. X      0x2d02ef8dL
  640. X   };
  641. X
  642. Xtypedef unsigned char byte;
  643. X
  644. X#define UPDCRC32(res,oct) res=crc_32_tab[(byte)res^(byte)oct] ^ ((res>>8) & 0x00FFFFFFL)
  645. X
  646. X/*
  647. X * macro UPDCRC32(res,oct)
  648. X *  res=crc_32_tab[(byte)res ^ (byte)oct] ^ ((res >> 8) & 0x00FFFFFFL)
  649. X *
  650. X */
  651. X
  652. X/* ------------------------------------------------------------- */
  653. X
  654. Xextern unsigned long crc32val;
  655. X
  656. Xvoid UpdateCRC(s, len)
  657. Xregister unsigned char *s;
  658. Xregister int len;
  659. X /* update running CRC calculation with contents of a buffer */
  660. X{
  661. X    register unsigned long crcval;
  662. X
  663. X    crcval = crc32val;
  664. X        while (len--) {
  665. X        crcval = crc_32_tab[(byte)crcval ^ (byte)(*s++)]
  666. X            ^ (crcval >> 8);
  667. X        }
  668. X    crc32val = crcval;
  669. X}
  670. X
  671. END_OF_FILE
  672. if test 7543 -ne `wc -c <'crc32.c'`; then
  673.     echo shar: \"'crc32.c'\" unpacked with wrong size!
  674. fi
  675. # end of 'crc32.c'
  676. fi
  677. if test -f 'info-zip.msg' -a "${1}" != "-c" ; then 
  678.   echo shar: Will not clobber existing file \"'info-zip.msg'\"
  679. else
  680. echo shar: Extracting \"'info-zip.msg'\" \(1525 characters\)
  681. sed "s/^X//" >'info-zip.msg' <<'END_OF_FILE'
  682. XDate: Wed, 11 Apr 1990  01:36 MDT
  683. XFrom: Keith Petersen <w8sdz@WSMR-SIMTEL20.ARMY.MIL>
  684. XTo: David Kirschbaum <kirsch@usasoc.soc.mil>
  685. XCc: Info-ZIP@WSMR-SIMTEL20.ARMY.MIL
  686. XSubject: Release of unzip for Unix
  687. X
  688. X> I've been waiting to see if there were any new changes/improvements, but
  689. X> nothing lately.  I guess there ARE still some systems the latest won't run
  690. X> on .. but nobody's fixing it.  So be it.
  691. X
  692. XPlease put a note in the release, telling how to contact Info-ZIP to
  693. Xreport bugs/improvements/additional ports.  The uucp address most
  694. Xuseful to Usenet people would be:  uunet!wsmr-simtel20.army.mil!info-zip
  695. X
  696. X> (And I've been good too .. didn't stick in ONE "Toad" ANYWHERE!)
  697. X
  698. XAnyone who knows about the world famous Toad Hall source of programs
  699. Xwill know what a sacrifice you've made.  Thanks!   :-)
  700. X
  701. X--Keith
  702. X
  703. X(And back at Toad Hall .. that "world famous" bit is an inside joke,
  704. Xguys .. we're just kidding .. really!
  705. X
  706. XSo .. to contact Info-ZIP for reporting bugs/improvements/additional ports:
  707. X  Usenet people via uucp:  uunet!wsmr-simtel20.army.mil!info-zip
  708. X  ARPAnet:           Info-ZIP@wsmr-simtel20.army.mil
  709. X
  710. XDavid Kirschbaum
  711. Xmoderator?
  712. X13 Apr 90
  713. X
  714. X22 May 90:  Keith is moving Info-ZIP to another host, so the above addresses
  715. Xwill be:
  716. X  Usenet people via uucp:  uunet!tacom-emh1.army.mil!info-zip
  717. X  ARPAnet:           Info-ZIP@tacom-emh1.army.mil
  718. X
  719. X25 May 90:  Informed yet again by Keith that (because he's also losing access
  720. Xto tacom-emh1) Info-ZIP will return to wsmr-simtel20.army.mil
  721. Xso .. back to the original addresses, folks.
  722. X
  723. END_OF_FILE
  724. if test 1525 -ne `wc -c <'info-zip.msg'`; then
  725.     echo shar: \"'info-zip.msg'\" unpacked with wrong size!
  726. fi
  727. # end of 'info-zip.msg'
  728. fi
  729. if test -f 'levels.uue' -a "${1}" != "-c" ; then 
  730.   echo shar: Will not clobber existing file \"'levels.uue'\"
  731. else
  732. echo shar: Extracting \"'levels.uue'\" \(1103 characters\)
  733. sed "s/^X//" >'levels.uue' <<'END_OF_FILE'
  734. Xbegin 664 levels.zip
  735. XM4$L#!`H``````%1ZFA1RC&T(8@```&(````)````3$5614PN5%A45&AI<R!I
  736. XM<R!<=&5M<"X@($ET(&AA<R!T=V\@<W5B9&ER96-T;W)I97,@*&QE=F5L,2!A
  737. XM;F0@;&5V96PR*2P-"F)O=&@@=VET:"!O;F4@<W5B9&ER96-T;W)Y(&5A8V@N
  738. XM#0I02P,$"@``````^GF:%/)3,2H2````$@```!$```!,159%3#$O3$5614PQ
  739. XM+E185%1H:7,@:7,@7&QE=F5L,2X-"E!+`P0*``````#Q>9H4[]!.ZAH````:
  740. XM````&@```$Q%5D5,,2],159%3#$Q+TQ%5D5,,3$N5%A45&AI<R!I<R!<;&5V
  741. XM96PQ7&QE=F5L,3$N#0I02P,$"@``````"GJ:%!S\A#@2````$@```!$```!,
  742. XM159%3#(O3$5614PR+E185%1H:7,@:7,@7&QE=F5L,BX-"E!+`P0*```````4
  743. XM>IH4SWAPVAH````:````&@```$Q%5D5,,B],159%3#(Q+TQ%5D5,,C$N5%A4
  744. XM5&AI<R!I<R!<;&5V96PR7&QE=F5L,C$N#0I02P$""P`*``````!4>IH4<HQM
  745. XM"&(```!B````"0`````````!`"``````````3$5614PN5%A44$L!`@L`"@``
  746. XM````^GF:%/)3,2H2````$@```!$``````````0`@````B0```$Q%5D5,,2],
  747. XM159%3#$N5%A44$L!`@L`"@``````\7F:%._03NH:````&@```!H`````````
  748. XM`0`@````R@```$Q%5D5,,2],159%3#$Q+TQ%5D5,,3$N5%A44$L!`@L`"@``
  749. XM````"GJ:%!S\A#@2````$@```!$``````````0`@````'`$``$Q%5D5,,B],
  750. XM159%3#(N5%A44$L!`@L`"@``````%'J:%,]X<-H:````&@```!H`````````
  751. XM`0`@````70$``$Q%5D5,,B],159%3#(Q+TQ%5D5,,C$N5%A44$L%!@`````%
  752. X-``4`10$``*\!`````$5,
  753. X`
  754. Xend
  755. END_OF_FILE
  756. if test 1103 -ne `wc -c <'levels.uue'`; then
  757.     echo shar: \"'levels.uue'\" unpacked with wrong size!
  758. fi
  759. # end of 'levels.uue'
  760. fi
  761. if test -f 'mapname.c' -a "${1}" != "-c" ; then 
  762.   echo shar: Will not clobber existing file \"'mapname.c'\"
  763. else
  764. echo shar: Extracting \"'mapname.c'\" \(4811 characters\)
  765. sed "s/^X//" >'mapname.c' <<'END_OF_FILE'
  766. X/*
  767. X mapname.c  for unzip v3.05
  768. X
  769. X Change DEC-20, VAX/VMS, DOS style filenames into normal Unix names.
  770. X Almost ALL the code is from good old xxu, Author:  F. da Cruz, CUCCA
  771. X
  772. X We're assuming, of course, that someday somebody will be creating
  773. X files on DECs and VAX/VMS systems, of course.
  774. X
  775. X Usage: set the "-m" switch on the unzip command line.
  776. X
  777. X Action: Renames argument files as follows:
  778. X   strips Unix and PKZIP DOS path name from front (up to rightmost '/')
  779. X   if present.
  780. X   strips DEC device:, node:: names from front (up to rightmost ':')
  781. X   if present.  (This also takes care of any DOS drive: artifacts.)
  782. X   strips DEC-20 <directory> or VMS [directory] name if present
  783. X   strips DEC-20 version number from end (everything after 2nd dot) if present
  784. X   strips VMS generation number from end (everything after ';') if present
  785. X   lowercases any uppercase letters
  786. X   honors DEC-20 CTRL-V quote for special characters
  787. X   discards unquoted unprintable characters
  788. X
  789. X   Returns non-0 if filename zeroed out.
  790. X
  791. X Author:  David Kirschbaum, 25 Apr 90
  792. X
  793. X 27 Apr 90: Reports indicate something's SERIOUSLY wrong.  When -m switch
  794. X is enabled, it gobbles digits in file names!  Sigh ... Fixed.
  795. X Sloppy testing.
  796. X David Kirschbaum
  797. X
  798. X 25 Apr 90:  Bill Davidsen did some tweaking.  v3.05
  799. X
  800. X*/
  801. X
  802. X#ifndef UNIX
  803. X#ifndef STRSIZ
  804. X#define STRSIZ 256
  805. X#endif
  806. X#endif
  807. X
  808. X#include <stdio.h>
  809. X /* this is your standard header for all C compiles */
  810. X#include <ctype.h>
  811. X#include <stdio.h>
  812. X
  813. X#ifdef UNIX
  814. X
  815. X/* On some systems the contents of sys/param.h duplicates the
  816. X   contents of sys/types.h, so you don't need (and can't use)
  817. X   sys/types.h. */
  818. X
  819. X#include <sys/types.h>
  820. X#endif
  821. X
  822. X#ifdef __STDC__
  823. X
  824. X#include <string.h>
  825. X /* this include defines strcpy, strcmp, etc. */
  826. X#endif
  827. X
  828. X
  829. Xextern char filename[];        /* in unzip.c */
  830. Xextern int mflag;
  831. X
  832. Xmapped_name()
  833. X{
  834. X    char name[13];            /* File name buffer (long enough
  835. X                         * for a DOS filename) */
  836. X    char *pp, *cp, *xp;            /* Character pointers */
  837. X    char delim = '\0';            /* Directory Delimiter */
  838. X    int dc = 0;                /* Counters */
  839. X    int quote = 0;            /* Flags */
  840. X    int indir = 0;
  841. X    int done = 0;
  842. X    register int workch;        /* hold the character being tested */
  843. X
  844. X
  845. X    xp = filename;        /* Copy pointer for simplicity */
  846. X#ifdef MAP_DEBUG
  847. X    fprintf(stderr,"%s ",*xp);    /* Echo name of this file */
  848. X#endif
  849. X    pp = name;            /* Point to translation buffer */
  850. X    *name = '\0';        /* Initialize buffer */
  851. X    dc = 0;            /* Filename dot counter */
  852. X    done = 0;            /* Flag for early completion */
  853. X
  854. X    for (cp = xp; workch = *cp++; ) { /* Loop thru chars... */
  855. X
  856. X    if (quote) {        /* If this char quoted.. */
  857. X        *pp++ = workch;    /*  include it literally. */
  858. X        quote = 0;
  859. X        }
  860. X    else if (indir) {    /* If in directory name.. */
  861. X        if (workch == delim)
  862. X        indir = 0;    /* look for end delimiter. */
  863. X        }
  864. X        else switch (workch) {
  865. X        case '<':        /* Discard DEC-20 directory name */
  866. X        indir = 1;
  867. X        delim = '>';
  868. X        break;
  869. X        case '[':        /* Discard VMS directory name */
  870. X        indir = 1;
  871. X        delim = ']';
  872. X        break;
  873. X        case '/':        /* Discard Unix path name.. */
  874. X        case '\\':        /*  or MS-DOS path name.. */
  875. X        case ':':       /*  or DEC dev: or node:: name */
  876. X        pp = name;
  877. X        break;
  878. X        case '.':        /* DEC -20 generation number
  879. X                 * or MS-DOS type */
  880. X        if (++dc == 1)    /* Keep first dot */
  881. X            *pp++ = workch;
  882. X        else        /* Discard everything starting */
  883. X            done = 1;    /* with second dot. */
  884. X        break;
  885. X        case ';':        /* VMS generation or DEC-20 attrib */
  886. X        done = 1;    /* Discard everything starting with */
  887. X        break;        /* semicolon */
  888. X        case '\026':    /* Control-V quote for special chars */
  889. X        quote = 1;    /* Set flag for next time. */
  890. X        break;
  891. X        default:        /* some other char */
  892. X        if(isdigit(workch))    /* v2.0k '0'..'9' */
  893. X            *pp++ = workch;    /* v2.0k accept them, no tests */
  894. X        else{
  895. X            if(mflag){        /* if -m switch.. */
  896. X                if (isupper(workch)) /* Uppercase letter to lowercase */
  897. X                        workch = tolower(workch);
  898. X            }
  899. X            if (workch == ' ')  /* change blanks to underscore */
  900. X                *pp++ = '_';
  901. X            else if (isprint(workch)) /* Other printable, just keep */
  902. X                *pp++ = workch;
  903. X        }
  904. X    }  /* switch */
  905. X    }  /* for loop */
  906. X    *pp = '\0';                /* Done with name, terminate it */
  907. X
  908. X    /* We COULD check for existing names right now,
  909. X     * create a "unique" name, etc.
  910. X     * However, since other unzips don't do that...
  911. X     * we won't bother.  Maybe another day, ne?
  912. X     * If this went bad, the name'll either be nulled out
  913. X     * (in which case we'll return non-0)
  914. X     * or following procedures won't be able to create the
  915. X     * extracted file, and other error msgs will result.
  916. X     */
  917. X
  918. X    if(*name == '\0'){
  919. X    fprintf(stderr,"conversion of [%s] failed\n",filename);
  920. X    return(0);
  921. X    }
  922. X    strcpy(filename,name);    /* copy converted name into global */
  923. X    return(1);
  924. X}
  925. X
  926. END_OF_FILE
  927. if test 4811 -ne `wc -c <'mapname.c'`; then
  928.     echo shar: \"'mapname.c'\" unpacked with wrong size!
  929. fi
  930. # end of 'mapname.c'
  931. fi
  932. if test -f 'match.c' -a "${1}" != "-c" ; then 
  933.   echo shar: Will not clobber existing file \"'match.c'\"
  934. else
  935. echo shar: Extracting \"'match.c'\" \(4308 characters\)
  936. sed "s/^X//" >'match.c' <<'END_OF_FILE'
  937. X/*
  938. X *  arcmatch.c  1.1
  939. X *
  940. X *  Author: Thom Henderson
  941. X *  Original System V port: Mike Stump
  942. X *
  943. X * REVISION HISTORY
  944. X *
  945. X * 03/22/87  C. Seaman      enhancements, bug fixes, cleanup
  946. X * 11/13/89  C. Mascott     adapt for use with unzip
  947. X * 01/25/90  J. Cowan       match case-insensitive
  948. X * 03/17/90  D. Kirschbaum      Prototypes, other tweaks for Turbo C.
  949. X *
  950. X */
  951. X
  952. X/*
  953. X * ARC - Archive utility - ARCMATCH
  954. X * 
  955. X * Version 2.17, created on 12/17/85) at 20:32:18
  956. X *
  957. X * (C) COPYRIGHT 1985 by System Enhancement Associates; ALL RIGHTS RESERVED
  958. X *
  959. X *     Description:
  960. X *        This file contains service routines needed to maintain an archive.
  961. X */
  962. X
  963. X#include <sys/types.h>
  964. X#include <sys/dir.h>
  965. X#include <ctype.h>
  966. X
  967. X#ifdef __TURBOC__               /* v2.0b */
  968. X#include <stdio.h>      /* for printf() */
  969. X#include <stdlib.h>     /* for exit() */
  970. X#endif
  971. X
  972. X#define ASTERISK '*'        /* The '*' metacharacter */
  973. X#define QUESTION '?'        /* The '?' metacharacter */
  974. X#define BACK_SLASH '\\'         /* The '\' metacharacter */
  975. X#define LEFT_BRACKET '['    /* The '[' metacharacter */
  976. X#define RIGHT_BRACKET ']'   /* The ']' metacharacter */
  977. X
  978. X#define IS_OCTAL(ch) (ch >= '0' && ch <= '7')
  979. X
  980. Xtypedef short int INT;      /* v2.0b */
  981. Xtypedef short int BOOLEAN;  /* v2.0b */
  982. X#define TRUE 1
  983. X#define FALSE 0
  984. X#define EOS '\000'
  985. X
  986. X#ifdef __TURBOC__              /* v2.0b */
  987. X/* local prototypes for Turbo */
  988. X
  989. Xint match(char *string, char *pattern);
  990. Xstatic BOOLEAN do_list (register char *string, char *pattern);  /* v2.0b */
  991. Xstatic void list_parse (char **patp, char *lowp, char *highp);
  992. Xstatic char nextch (char **patp);
  993. X#else       /* v2.0b original code */
  994. Xstatic BOOLEAN do_list();
  995. Xstatic char nextch();
  996. Xstatic void list_parse();
  997. X#endif
  998. X
  999. Xint match(string, pattern)
  1000. Xchar *string;
  1001. Xchar *pattern;
  1002. X{
  1003. X    register int ismatch;
  1004. X
  1005. X    ismatch = FALSE;
  1006. X    switch (*pattern)
  1007. X    {
  1008. X    case ASTERISK:
  1009. X        pattern++;
  1010. X        do
  1011. X        {
  1012. X            ismatch = match (string, pattern);
  1013. X        }
  1014. X        while (!ismatch && *string++ != EOS);
  1015. X        break;
  1016. X    case QUESTION:
  1017. X        if (*string != EOS)
  1018. X            ismatch = match (++string, ++pattern);
  1019. X        break;
  1020. X    case EOS:
  1021. X        if (*string == EOS)
  1022. X            ismatch = TRUE;
  1023. X        break;
  1024. X    case LEFT_BRACKET:
  1025. X        if (*string != EOS)
  1026. X            ismatch = do_list (string, pattern);
  1027. X        break;
  1028. X    case BACK_SLASH:
  1029. X        pattern++;
  1030. X    default:
  1031. X    if (toupper(*string) == toupper(*pattern))
  1032. X        {
  1033. X            string++;
  1034. X            pattern++;
  1035. X            ismatch = match (string, pattern);
  1036. X        }
  1037. X        else
  1038. X            ismatch = FALSE;
  1039. X        break;
  1040. X    }
  1041. X    return(ismatch);
  1042. X}
  1043. X
  1044. Xstatic BOOLEAN do_list (string, pattern)
  1045. Xregister char *string;
  1046. Xchar *pattern;
  1047. X{
  1048. X    register BOOLEAN ismatch;
  1049. X    register BOOLEAN if_found;
  1050. X    register BOOLEAN if_not_found;
  1051. X    auto char lower;
  1052. X    auto char upper;
  1053. X
  1054. X    pattern++;
  1055. X    if (*pattern == '!')
  1056. X    {
  1057. X        if_found = FALSE;
  1058. X        if_not_found = TRUE;
  1059. X        pattern++;
  1060. X    }
  1061. X    else
  1062. X    {
  1063. X        if_found = TRUE;
  1064. X        if_not_found = FALSE;
  1065. X    }
  1066. X    ismatch = if_not_found;
  1067. X    while (*pattern != ']' && *pattern != EOS)
  1068. X    {
  1069. X        list_parse(&pattern, &lower, &upper);
  1070. X        if (*string >= lower && *string <= upper)
  1071. X        {
  1072. X            ismatch = if_found;
  1073. X            while (*pattern != ']' && *pattern != EOS) pattern++;
  1074. X        }
  1075. X    }
  1076. X
  1077. X    if (*pattern++ != ']')
  1078. X    {
  1079. X        printf("Character class error\n");
  1080. X        exit(1);
  1081. X    }
  1082. X    else
  1083. X        if (ismatch)
  1084. X            ismatch = match (++string, pattern);
  1085. X
  1086. X    return(ismatch);
  1087. X}
  1088. X
  1089. Xstatic void list_parse (patp, lowp, highp)
  1090. Xchar **patp;
  1091. Xchar *lowp;
  1092. Xchar *highp;
  1093. X{
  1094. X    *lowp = nextch (patp);
  1095. X    if (**patp == '-')
  1096. X    {
  1097. X        (*patp)++;
  1098. X        *highp = nextch(patp);
  1099. X    }
  1100. X    else
  1101. X        *highp = *lowp;
  1102. X}
  1103. X
  1104. Xstatic char nextch (patp)
  1105. Xchar **patp;
  1106. X{
  1107. X    register char ch;
  1108. X    register char chsum;
  1109. X    register INT count;
  1110. X
  1111. X    ch = *(*patp)++;
  1112. X    if (ch == '\\')
  1113. X    {
  1114. X        ch = *(*patp)++;
  1115. X        if (IS_OCTAL (ch))
  1116. X        {
  1117. X            chsum = 0;
  1118. X            for (count = 0; count < 3 && IS_OCTAL (ch); count++)
  1119. X            {
  1120. X                chsum *= 8;
  1121. X                chsum += ch - '0';
  1122. X                ch = *(*patp)++;
  1123. X            }
  1124. X            (*patp)--;
  1125. X            ch = chsum;
  1126. X        }
  1127. X    }
  1128. X    return(ch);
  1129. X}
  1130. X
  1131. END_OF_FILE
  1132. if test 4308 -ne `wc -c <'match.c'`; then
  1133.     echo shar: \"'match.c'\" unpacked with wrong size!
  1134. fi
  1135. # end of 'match.c'
  1136. fi
  1137. if test -f 'minix20g.pat' -a "${1}" != "-c" ; then 
  1138.   echo shar: Will not clobber existing file \"'minix20g.pat'\"
  1139. else
  1140. echo shar: Extracting \"'minix20g.pat'\" \(1682 characters\)
  1141. sed "s/^X//" >'minix20g.pat' <<'END_OF_FILE'
  1142. XFrom: mbeck@ai.mit.edu (Mark Becker)
  1143. XDate: Thu, 5 Apr 90 16:17:27 EDT
  1144. XTo: kirsch@arsocomvax.socom.mil
  1145. XSubject: BINGO!  unzip20g.tar.Z functional under MINIX
  1146. X
  1147. XPulled a copy of 20g from White Sands and tried it out.
  1148. X
  1149. XMinix C still gets crc32.c wrong .. enclosed is a context diff for
  1150. Xwhat I did to get it running.  Nothing earthshaking.. but CRC's on
  1151. Xthis thing won't come out right unless the unused bits are masked off.
  1152. XHow would you handle the code change?  As a context diff supplied
  1153. Xseparately or a #ifdef MINIX ?
  1154. X
  1155. XAlso enclosed is the stripped-down makefile I used for this.  I did it
  1156. Xthis way because Minix is a small model system (64K data/64K code) and
  1157. Xrunning two makes eats a lot of memory.  Feel free to modify as you'd
  1158. Xlike; I can pull a new Makefile and test at your convience.
  1159. X
  1160. XI wonder why zmemcpy.c doesn't used unsigned character pointers?  For
  1161. Xa test I changed from signed chars (the default under Minix) to
  1162. Xunsigned chars and things still ran okay.  Come to think of it, I'm
  1163. Xnot sure it really matters...  :-)
  1164. X
  1165. XHOORAY!
  1166. X
  1167. XRegards,
  1168. XMark
  1169. Xmbeck@ai.mit.edu
  1170. X-- cut here -- cut here -- cut here -- cut here -- cut here 
  1171. X*** crc32.c.old    Fri Mar 23 05:51:24 1990
  1172. X--- crc32.c    Thu Apr  5 16:05:48 1990
  1173. X***************
  1174. X*** 125,131 ****
  1175. X
  1176. X      crcval = crc32val;
  1177. X          while (len--) {
  1178. X!         crcval = crc_32_tab[(byte)crcval ^ (byte)(*s++)]
  1179. X              ^ (crcval >> 8);
  1180. X          }
  1181. X      crc32val = crcval;
  1182. X--- 125,131 ----
  1183. X
  1184. X      crcval = crc32val;
  1185. X          while (len--) {
  1186. X!         crcval = crc_32_tab[(int)((0x0FF & crcval) ^ (*s++))]
  1187. X              ^ (crcval >> 8);
  1188. X          }
  1189. X      crc32val = crcval;
  1190. X-- cut here -- cut here -- cut here -- cut here -- cut here 
  1191. END_OF_FILE
  1192. if test 1682 -ne `wc -c <'minix20g.pat'`; then
  1193.     echo shar: \"'minix20g.pat'\" unpacked with wrong size!
  1194. fi
  1195. # end of 'minix20g.pat'
  1196. fi
  1197. if test -f 'mips.pat' -a "${1}" != "-c" ; then 
  1198.   echo shar: Will not clobber existing file \"'mips.pat'\"
  1199. else
  1200. echo shar: Extracting \"'mips.pat'\" \(2238 characters\)
  1201. sed "s/^X//" >'mips.pat' <<'END_OF_FILE'
  1202. XDate: Fri, 27 Apr 90 05:15:29 EDT
  1203. XFrom: jones@mips1.uqam.ca (Jones*Peter)
  1204. XMessage-Id: <9004270915.AA23290@mips1.uqam.CA>
  1205. XApparently-To: info-zip@simtel20.army.mil
  1206. X
  1207. X         
  1208. XHere is my compile and test run on a mips machine. It works fine, despite a
  1209. Xcertain number of lint message. The procdeure was invoked with;
  1210. Xmake -f Makefile.mips > (the file your are reading now) .
  1211. X
  1212. X        test  -z mips -f Makefile.mips  \    <--- make default
  1213. X        && make ERROR -f Makefile.mips \
  1214. X        || make mips -f Makefile.mips
  1215. X        uname -A
  1216. Xmips1 mips1 4_0 UMIPS mips m120-5 ATT_V3_0    <---- make mips
  1217. X        ls -l Makefile.mips Makefile
  1218. X-rw-rw-r--   1 jones    prof        5003 Apr 26 08:52 Makefile
  1219. X-rw-------   1 jones    prof        5677 Apr 27 05:04 Makefile.mips
  1220. X2c2,3                   <------ changes to Makefile (only file changed)
  1221. X< 
  1222. X---
  1223. X> # P. Jones UQAM April 27th, 1990
  1224. X> # Added support for Mips
  1225. X62a64
  1226. X> ZMEMC = zmemset.c zmemcpy.c
  1227. X66c68,69
  1228. X< SYSTEMS       =xenix386 ultrix sun3 sun4 encore stellar convex vaxbsd next vaxsysV
  1229. X---
  1230. X> SYSTEMS       =xenix386 ultrix sun3 sun4 encore stellar convex vaxbsd next vaxsysV mips
  1231. X> SYSTEM = mips
  1232. X68c71
  1233. X< # The below will try to use your shell variable "SYSTEM"
  1234. X---
  1235. X> # The code below will try to use your shell variable "SYSTEM"
  1236. X74,77c77,80
  1237. X<       if test -z "$(SYSTEM)";\       <---- Causes a syntax error on our system
  1238. X<       then make ERROR;\
  1239. X<       else make $(SYSTEM);\
  1240. X<       fi
  1241. X---
  1242. X>       - test  -z $(SYSTEM) -f Makefile.mips  \
  1243. X>       && make ERROR -f Makefile.mips \
  1244. X>       || make $(SYSTEM) -f Makefile.mips
  1245. X>       exit
  1246. X85a89
  1247. X>       rm $(OBJS)
  1248. X158a163,177
  1249. X> # Mips code is here
  1250. X> mips: #MIPS System V
  1251. X> #Print system identification
  1252. X>       uname -A
  1253. X> # Show file creation date
  1254. X>       ls -l Makefile.mips Makefile
  1255. X> #show differences in Makefile and this file
  1256. X>       @- diff Makefile Makefile.mips
  1257. X> #Actual coplilation run
  1258. X>       $(MAKE) unzip CFLAGS="$(CFLAGS) -DNOTINT16 -DZMEM"      \
  1259. X>       OBJS="$(OBJS) $(ZMEMS)"  
  1260. X> #Test on a handy file
  1261. X>       ./unzip -t levels.zip
  1262. X> #Run lint to finish up
  1263. X>       lint $(CFLAGS) -DNOTINT16 -DZMEM $(SRCS) $(ZMEMC)
  1264. X160c179,182
  1265. X< 
  1266. X---
  1267. X> # added the useful function below....
  1268. X> clean:
  1269. X>       - rm $(OBJS) 
  1270. X>       - rm unzip
  1271. END_OF_FILE
  1272. if test 2238 -ne `wc -c <'mips.pat'`; then
  1273.     echo shar: \"'mips.pat'\" unpacked with wrong size!
  1274. fi
  1275. # end of 'mips.pat'
  1276. fi
  1277. if test -f 'unreduce.c' -a "${1}" != "-c" ; then 
  1278.   echo shar: Will not clobber existing file \"'unreduce.c'\"
  1279. else
  1280. echo shar: Extracting \"'unreduce.c'\" \(4613 characters\)
  1281. sed "s/^X//" >'unreduce.c' <<'END_OF_FILE'
  1282. X/* ----------------------------------------------------------- */
  1283. X
  1284. Xvoid LoadFollowers()
  1285. X{
  1286. X    register int x;
  1287. X    register int i;
  1288. X
  1289. X    for (x = 255; x >= 0; x--) {
  1290. X        READBIT(6,Slen[x]);
  1291. X        for (i = 0; i < Slen[x]; i++) {
  1292. X            READBIT(8,followers[x][i]);
  1293. X        }
  1294. X    }
  1295. X}
  1296. X
  1297. X
  1298. X/* ----------------------------------------------------------- */
  1299. X/*
  1300. X * The Reducing algorithm is actually a combination of two
  1301. X * distinct algorithms.  The first algorithm compresses repeated
  1302. X * byte sequences, and the second algorithm takes the compressed
  1303. X * stream from the first algorithm and applies a probabilistic
  1304. X * compression method.
  1305. X */
  1306. X
  1307. Xint L_table[] = {0, 0x7f, 0x3f, 0x1f, 0x0f};
  1308. X
  1309. Xint D_shift[] = {0, 0x07, 0x06, 0x05, 0x04};
  1310. Xint D_mask[]  = {0, 0x01, 0x03, 0x07, 0x0f};
  1311. X
  1312. Xint B_table[] = {8, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5,
  1313. X                 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6,
  1314. X                 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
  1315. X                 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7,
  1316. X                 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  1317. X                 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  1318. X                 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  1319. X                 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  1320. X                 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  1321. X                 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  1322. X                 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  1323. X                 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  1324. X                 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  1325. X                 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  1326. X                 8, 8, 8, 8};
  1327. X
  1328. X/* ----------------------------------------------------------- */
  1329. X
  1330. Xvoid unReduce()
  1331. X /* expand probablisticly reduced data */
  1332. X{
  1333. X    register int lchar;
  1334. X    int nchar;
  1335. X    int ExState;
  1336. X    int V;
  1337. X    int Len;
  1338. X
  1339. X    factor = lrec.compression_method - 1;
  1340. X    ExState = 0;
  1341. X    lchar = 0;
  1342. X    LoadFollowers();
  1343. X
  1344. X    while (((outpos+outcnt) < ucsize) && (!zipeof)) {
  1345. X        if (Slen[lchar] == 0)
  1346. X            READBIT(8,nchar)      /* ; */
  1347. X        else
  1348. X        {
  1349. X            READBIT(1,nchar);
  1350. X            if (nchar != 0)
  1351. X                READBIT(8,nchar)      /* ; */
  1352. X            else
  1353. X            {
  1354. X                int follower;
  1355. X                int bitsneeded = B_table[Slen[lchar]];
  1356. X                READBIT(bitsneeded,follower);
  1357. X                nchar = followers[lchar][follower];
  1358. X            }
  1359. X        }
  1360. X
  1361. X        /* expand the resulting byte */
  1362. X        switch (ExState) {
  1363. X
  1364. X        case 0:
  1365. X            if (nchar != DLE)
  1366. X                OUTB(nchar) /*;*/
  1367. X            else
  1368. X                ExState = 1;
  1369. X            break;
  1370. X
  1371. X        case 1:
  1372. X            if (nchar != 0) {
  1373. X                V = nchar;
  1374. X                Len = V & L_table[factor];
  1375. X                if (Len == L_table[factor])
  1376. X                    ExState = 2;
  1377. X                else
  1378. X                    ExState = 3;
  1379. X            }
  1380. X            else {
  1381. X                OUTB(DLE);
  1382. X                ExState = 0;
  1383. X            }
  1384. X            break;
  1385. X
  1386. X        case 2: {
  1387. X                Len += nchar;
  1388. X                ExState = 3;
  1389. X            }
  1390. X            break;
  1391. X
  1392. X        case 3: {
  1393. X                register int i = Len + 3;
  1394. X                int offset = (((V >> D_shift[factor]) &
  1395. X                                     D_mask[factor]) << 8) + nchar + 1;
  1396. X                longint op = (outpos+outcnt) - offset;
  1397. X
  1398. X                /* special case- before start of file */
  1399. X                while ((op < 0L) && (i > 0)) {
  1400. X                    OUTB(0);
  1401. X                    op++;
  1402. X                    i--;
  1403. X                }
  1404. X
  1405. X                /* normal copy of data from output buffer */
  1406. X                {
  1407. X                    register int ix = (int) (op % OUTBUFSIZ);
  1408. X
  1409. X                    /* do a block memory copy if possible */
  1410. X                    if ( ((ix    +i) < OUTBUFSIZ) &&
  1411. X                      ((outcnt+i) < OUTBUFSIZ) ) {
  1412. X                        zmemcpy(outptr,&outbuf[ix],i);
  1413. X                        outptr += i;
  1414. X                        outcnt += i;
  1415. X                    }
  1416. X
  1417. X                    /* otherwise copy byte by byte */
  1418. X                    else while (i--) {
  1419. X                        OUTB(outbuf[ix]);
  1420. X                        if (++ix >= OUTBUFSIZ)
  1421. X                            ix = 0;
  1422. X                    }
  1423. X                }
  1424. X
  1425. X                ExState = 0;
  1426. X            }
  1427. X            break;
  1428. X        }
  1429. X
  1430. X        /* store character for next iteration */
  1431. X        lchar = nchar;
  1432. X    }
  1433. X}
  1434. X
  1435. END_OF_FILE
  1436. if test 4613 -ne `wc -c <'unreduce.c'`; then
  1437.     echo shar: \"'unreduce.c'\" unpacked with wrong size!
  1438. fi
  1439. # end of 'unreduce.c'
  1440. fi
  1441. if test -f 'unshrink.c' -a "${1}" != "-c" ; then 
  1442.   echo shar: Will not clobber existing file \"'unshrink.c'\"
  1443. else
  1444. echo shar: Extracting \"'unshrink.c'\" \(3566 characters\)
  1445. sed "s/^X//" >'unshrink.c' <<'END_OF_FILE'
  1446. X/* ------------------------------------------------------------- */
  1447. X/*
  1448. X * Shrinking is a Dynamic Ziv-Lempel-Welch compression algorithm
  1449. X * with partial clearing.
  1450. X *
  1451. X */
  1452. X
  1453. Xvoid partial_clear()
  1454. X{
  1455. X    register int pr;
  1456. X    register int cd;
  1457. X
  1458. X    /* mark all nodes as potentially unused */
  1459. X    for (cd = first_ent; cd < free_ent; cd++)
  1460. X        prefix_of[cd] |= 0x8000;
  1461. X
  1462. X    /* unmark those that are used by other nodes */
  1463. X    for (cd = first_ent; cd < free_ent; cd++) {
  1464. X        pr = prefix_of[cd] & 0x7fff;    /* reference to another node? */
  1465. X        if (pr >= first_ent)            /* flag node as referenced */
  1466. X            prefix_of[pr] &= 0x7fff;
  1467. X    }
  1468. X
  1469. X    /* clear the ones that are still marked */
  1470. X    for (cd = first_ent; cd < free_ent; cd++)
  1471. X        if ((prefix_of[cd] & 0x8000) != 0)
  1472. X            prefix_of[cd] = -1;
  1473. X
  1474. X    /* find first cleared node as next free_ent */
  1475. X    cd = first_ent;
  1476. X    while ((cd < maxcodemax) && (prefix_of[cd] != -1))
  1477. X        cd++;
  1478. X    free_ent = cd;
  1479. X}
  1480. X
  1481. X
  1482. X/* ------------------------------------------------------------- */
  1483. X
  1484. Xvoid unShrink()
  1485. X{
  1486. X#define  GetCode(dest) READBIT(codesize,dest)
  1487. X
  1488. X    register int code;
  1489. X    register int stackp;
  1490. X    int finchar;
  1491. X    int oldcode;
  1492. X    int incode;
  1493. X
  1494. X
  1495. X    /* decompress the file */
  1496. X    maxcodemax = 1 << max_bits;
  1497. X    codesize = init_bits;
  1498. X    maxcode = (1 << codesize) - 1;
  1499. X    free_ent = first_ent;
  1500. X    offset = 0;
  1501. X    sizex = 0;
  1502. X
  1503. X    for (code = maxcodemax; code > 255; code--)
  1504. X        prefix_of[code] = -1;
  1505. X
  1506. X    for (code = 255; code >= 0; code--) {
  1507. X        prefix_of[code] = 0;
  1508. X        suffix_of[code] = code;
  1509. X    }
  1510. X
  1511. X    GetCode(oldcode);
  1512. X    if (zipeof)
  1513. X        return;
  1514. X    finchar = oldcode;
  1515. X
  1516. X    OUTB(finchar);
  1517. X
  1518. X    stackp = hsize;
  1519. X
  1520. X    while (!zipeof) {
  1521. X        GetCode(code);
  1522. X        if (zipeof)
  1523. X            return;
  1524. X
  1525. X        while (code == clear) {
  1526. X            GetCode(code);
  1527. X            switch (code) {
  1528. X
  1529. X            case 1:{
  1530. X                    codesize++;
  1531. X                    if (codesize == max_bits)
  1532. X                        maxcode = maxcodemax;
  1533. X                    else
  1534. X                        maxcode = (1 << codesize) - 1;
  1535. X                }
  1536. X                break;
  1537. X
  1538. X            case 2:
  1539. X                partial_clear();
  1540. X                break;
  1541. X            }
  1542. X
  1543. X            GetCode(code);
  1544. X            if (zipeof)
  1545. X                return;
  1546. X        }
  1547. X
  1548. X
  1549. X        /* special case for KwKwK string */
  1550. X        incode = code;
  1551. X        if (prefix_of[code] == -1) {
  1552. X            stack[--stackp] = finchar;
  1553. X            code = oldcode;
  1554. X        }
  1555. X
  1556. X
  1557. X        /* generate output characters in reverse order */
  1558. X        while (code >= first_ent) {
  1559. X            stack[--stackp] = suffix_of[code];
  1560. X            code = prefix_of[code];
  1561. X        }
  1562. X
  1563. X        finchar = suffix_of[code];
  1564. X        stack[--stackp] = finchar;
  1565. X
  1566. X
  1567. X        /* and put them out in forward order, block copy */
  1568. X        if ((hsize-stackp+outcnt) < OUTBUFSIZ) {
  1569. X            zmemcpy(outptr,&stack[stackp],hsize-stackp);
  1570. X            outptr += hsize-stackp;
  1571. X            outcnt += hsize-stackp;
  1572. X            stackp = hsize;
  1573. X        }
  1574. X
  1575. X        /* output byte by byte if we can't go by blocks */
  1576. X        else while (stackp < hsize)
  1577. X            OUTB(stack[stackp++]);
  1578. X
  1579. X
  1580. X        /* generate new entry */
  1581. X        code = free_ent;
  1582. X        if (code < maxcodemax) {
  1583. X            prefix_of[code] = oldcode;
  1584. X            suffix_of[code] = finchar;
  1585. X
  1586. X            do
  1587. X                code++;
  1588. X            while ((code < maxcodemax) && (prefix_of[code] != -1));
  1589. X
  1590. X            free_ent = code;
  1591. X        }
  1592. X
  1593. X        /* remember previous code */
  1594. X        oldcode = incode;
  1595. X    }
  1596. X}
  1597. X
  1598. END_OF_FILE
  1599. if test 3566 -ne `wc -c <'unshrink.c'`; then
  1600.     echo shar: \"'unshrink.c'\" unpacked with wrong size!
  1601. fi
  1602. # end of 'unshrink.c'
  1603. fi
  1604. if test -f 'unzip.man' -a "${1}" != "-c" ; then 
  1605.   echo shar: Will not clobber existing file \"'unzip.man'\"
  1606. else
  1607. echo shar: Extracting \"'unzip.man'\" \(1903 characters\)
  1608. sed "s/^X//" >'unzip.man' <<'END_OF_FILE'
  1609. XDate: Fri, 25 May 90 12:52:22 -0500
  1610. XFrom: jpd@pc.usl.edu (jpd DugalJP)
  1611. XMessage-Id: <9005251752.AA28036@pc.usl.edu>
  1612. XTo: Info-ZIP@WSMR-SIMTEL20.ARMY.MIL
  1613. XSubject: Improved unzip man page
  1614. X
  1615. X.TH unzip 1 "version 3.0"
  1616. X.SH NAME
  1617. Xunzip - list/test/extract from a ZIP archive file
  1618. X.SH SYNOPSIS
  1619. Xunzip [-tvcam] file[.zip]  [filespec] ...
  1620. X.SH ARGUMENTS
  1621. X.in +12
  1622. X.ti -12
  1623. Xfile[.zip]  Path of the ZIP archive.  The suffix ".zip" is applied
  1624. Xif the entryname portion lacks a suffix.  Note that
  1625. Xself-extracting ZIP files are supported; just specify
  1626. Xthe ".exe" suffix yourself.
  1627. X.sp 1
  1628. X.ti -12
  1629. X[filespec]  An optional list of archive members to be processed.
  1630. XExpressions may be used to match multiple menbers.  See
  1631. XDESCRIPTION (below) for more details.
  1632. X.SH OPTIONS
  1633. X.nf
  1634. X-t    test archive contents for validity
  1635. X-v    view (ie, list) archive contents
  1636. X-c    extract to stdout
  1637. X.sp 1
  1638. X-a    convert <CR> <LF> at line end to <LF>
  1639. X-m    map extracted filenames to lower case
  1640. X.fi
  1641. X.SH DESCRIPTION
  1642. X.B unzip
  1643. Xwill list, test, or extract from a ZIP archive, commonly found on MSDOS
  1644. Xsystems.
  1645. XArchive member extraction is implied by the absence of the -v or -t
  1646. Xoptions.  All archive members are processed unless a
  1647. X.B filespec
  1648. Xis provided to specify a subset of the archive members.
  1649. XThe
  1650. X.B filespec
  1651. Xis similar to an egrep expression, and may contain:
  1652. X.sp 1
  1653. X.in +8
  1654. X.ti -8
  1655. X*       matches a sequence of 0 or more characters
  1656. X.ti -8
  1657. X?       matches exactly 1 character
  1658. X.ti -8
  1659. X\\nnn    matches the character having octal code nnn
  1660. X.ti -8
  1661. X[...]   matches any single character found inside the brackets; ranges
  1662. Xare specified by a beginning character, a hyphen, and an ending
  1663. Xcharacter.  If a '!' follows the left bracket, then the range
  1664. Xof characters matched is complemented, with respect to the ASCII
  1665. Xcharacter set.
  1666. X.SH AUTHOR
  1667. X.nf
  1668. Xv1.2    3/15/89    Samuel H. Smith
  1669. Xv2.x    1989 Many contributors.    
  1670. Xv3.0    5/1/90 David Kirschbaum consolidator, kirsch@arsocomvax.socom.mil
  1671. X.fi
  1672. X
  1673. END_OF_FILE
  1674. if test 1903 -ne `wc -c <'unzip.man'`; then
  1675.     echo shar: \"'unzip.man'\" unpacked with wrong size!
  1676. fi
  1677. # end of 'unzip.man'
  1678. fi
  1679. if test -f 'unzip310.des' -a "${1}" != "-c" ; then 
  1680.   echo shar: Will not clobber existing file \"'unzip310.des'\"
  1681. else
  1682. echo shar: Extracting \"'unzip310.des'\" \(2356 characters\)
  1683. sed "s/^X//" >'unzip310.des' <<'END_OF_FILE'
  1684. XUNZIP310.ARC    Current Unix unzip source
  1685. XUNZIP310.TAR-Z    Ditto, in compressed tar format
  1686. X
  1687. Xv3.10, 16 Aug 90
  1688. X- No significant changes.  Amdahl mainframe system added to Makefile.
  1689. X  (Who ever thought calling an Amdalh (IBM clone) a 68000 would work!?)
  1690. X- Dif file required for Coherent installation in coherent.msg.
  1691. X- Dif files required for Atari (Turbo C v2.0) in atari.zip
  1692. X  (atari.hdr is msg header for initial uuencoded transfer).
  1693. X  These dif files are for an earlier version (v3.06?) and may need
  1694. X  some tweaking to patch smoothly.
  1695. X  They (and the Coherent patches) have NOT been installed.     
  1696. X
  1697. XVersion 3.10 will be the current "fielded" version until further notice.
  1698. XNo patches to earlier versions will be accepted.  (PLEASE don't expect me
  1699. Xto be able to back-engineer your Wombat 68000 patches for v3.02!)
  1700. X
  1701. XThe Info-ZIP workgroup are currently working on a new beta-test version
  1702. Xthat may or may not involve the following "features":
  1703. X  - default lowercasing of extracted member file names
  1704. X  - IFDEFs for incremental vs. new "monster" compile
  1705. X  - Integration of the Atari (Turbo C) patches.
  1706. X  - Use of central directory for member listing and more.
  1707. X  - Use of central directory "created by" byte to make "intelligent"
  1708. X    guesses as to filename and/or text conversion.
  1709. X
  1710. X(No there were no versions 3.08 or 3.09: we went right from v3.07 (last
  1711. Xbeta test) to v3.10.)
  1712. X
  1713. XThis version will NOT be fielded via EMail to Info-ZIP members.
  1714. X
  1715. XAs soon as I can figure out how, I'll be transferring full source, history,
  1716. Xetc. to comp.sources.misc (wherever THAT is).
  1717. X
  1718. XThe above archives are currently maintained on SIMTEL20 in:
  1719. XPS:<KPETERSEN.ZIP> subdirectory, available for anonymous ftp (and other means
  1720. Xof snarfing).
  1721. X
  1722. XTo contact Info-ZIP for reporting bugs/improvements/additional ports:
  1723. X  Usenet people via uucp:  uunet!wsmr-simtel20.army.mil!info-zip
  1724. X  ARPAnet:           Info-ZIP@wsmr-simtel20.army.mil
  1725. X
  1726. XFor normal unzip-related messages and discussion, please address them to
  1727. XInfo-ZIP and not to me personally.  I'm only the coordinator and shall simply
  1728. Xredirect your messages to the Info-ZIP mailing list.  If it's something
  1729. Xpersonal or a monster mailing (like the Atari uuencoded archive of dif files)
  1730. Xyou don't wish to inflict on everyone .. ok, send to me and I'll figure out
  1731. Xhow to distribute, announce, implement, whatever.
  1732. X
  1733. XDavid Kirschbaum
  1734. XInfo-ZIP Coordinator
  1735. X
  1736. END_OF_FILE
  1737. if test 2356 -ne `wc -c <'unzip310.des'`; then
  1738.     echo shar: \"'unzip310.des'\" unpacked with wrong size!
  1739. fi
  1740. # end of 'unzip310.des'
  1741. fi
  1742. if test -f 'zmemcpy.c' -a "${1}" != "-c" ; then 
  1743.   echo shar: Will not clobber existing file \"'zmemcpy.c'\"
  1744. else
  1745. echo shar: Extracting \"'zmemcpy.c'\" \(200 characters\)
  1746. sed "s/^X//" >'zmemcpy.c' <<'END_OF_FILE'
  1747. X/* zmemcpy.c v2.0f */
  1748. X
  1749. Xchar *
  1750. Xzmemcpy(dst,src,len)
  1751. Xregister char *dst, *src;
  1752. Xregister int len;
  1753. X{
  1754. X    char *start;
  1755. X
  1756. X    start = dst;
  1757. X    while (len-- > 0)
  1758. X        *dst++ = *src++;
  1759. X    return(start);
  1760. X}
  1761. END_OF_FILE
  1762. if test 200 -ne `wc -c <'zmemcpy.c'`; then
  1763.     echo shar: \"'zmemcpy.c'\" unpacked with wrong size!
  1764. fi
  1765. # end of 'zmemcpy.c'
  1766. fi
  1767. if test -f 'zmemset.c' -a "${1}" != "-c" ; then 
  1768.   echo shar: Will not clobber existing file \"'zmemset.c'\"
  1769. else
  1770. echo shar: Extracting \"'zmemset.c'\" \(249 characters\)
  1771. sed "s/^X//" >'zmemset.c' <<'END_OF_FILE'
  1772. X/* zmemset - memset for systems without it
  1773. X *  bill davidsen - March 1990
  1774. X */
  1775. X
  1776. Xzmemset(buf, init, len)
  1777. X register char *buf, init;    /* buffer loc and initializer */
  1778. X register int len;        /* length of the buffer */
  1779. X{
  1780. X    while (len--) *(buf++) = init;
  1781. X}
  1782. END_OF_FILE
  1783. if test 249 -ne `wc -c <'zmemset.c'`; then
  1784.     echo shar: \"'zmemset.c'\" unpacked with wrong size!
  1785. fi
  1786. # end of 'zmemset.c'
  1787. fi
  1788. echo shar: End of archive 1 \(of 3\).
  1789. cp /dev/null ark1isdone
  1790. MISSING=""
  1791. for I in 1 2 3 ; do
  1792.     if test ! -f ark${I}isdone ; then
  1793.     MISSING="${MISSING} ${I}"
  1794.     fi
  1795. done
  1796. if test "${MISSING}" = "" ; then
  1797.     echo You have unpacked all 3 archives.
  1798.     rm -f ark[1-9]isdone
  1799. else
  1800.     echo You still need to unpack the following archives:
  1801.     echo "        " ${MISSING}
  1802. fi
  1803. ##  End of shell archive.
  1804. exit 0
  1805.